<!DOCTYPE html>
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorate="${username}=='zzz'?layout1:layout">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>景点</title>
    <script src="js/placelist/placelist.js"></script>
</head>

<body>
<div  layout:fragment="content">
    <div class="container-fluid">
        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
            <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-2 mb-3 border-bottom">
                <h1 class="h2">景点管理</h1>
            </div>
            <div class="row" style="margin-bottom: 15px">
                <button type="button" class="btn btn-outline-secondary" onclick="back()"><b>&larr;回到省份列表&larr;</b></button>
                <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addPla">添加景点</button>

            </div>

            <div>
                <table class="table table-striped" style="word-break:break-all">
                    <thead>
                    <tr>
                        <th scope="col">#</th>
                        <th scope="col">景点</th>
                        <th scope="col">简介</th>
                        <th scope="col">旺季门票</th>
                        <th scope="col">淡季门票</th>
                        <th scope="col">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each=" pla:${placeList}">
                        <th scope="row"></th>
                        <td th:text="${pla.name}"></td>
                        <td th:width="300px" th:text="${pla.placedes}"></td>
                        <td th:text="${pla.hotticket}"></td>
                        <td th:text="${pla.dimticket}"></td>
                        <td>
                            <a href="#" class="btn btn-danger btn-sm active" role="button" aria-pressed="true" th:onclick="deletePla([[${pla.id}]])">删除</a>
                            <a href="#" class="btn btn-success btn-sm active" role="button" aria-pressed="true" th:onclick="editPla([[${pla}]])">编辑</a>
                        </td>
                    </tr>

                    </tbody>
                </table>
            </div>
        </main>
    </div>

    <!--景点添加模态窗口-->
    <div class="modal fade" id="addPla" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLabel"><span style="color: #0c5460;font-weight: bold">添加景点</span></h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form name="form1" class="form-horizontal">
                        <input type="hidden" class="form-control col-sm-8"  id="plaId" >
                        <div class="form-group row">
                            <label class="col-form-label col-sm-3">景点:</label>
                            <input type="text" class="form-control col-sm-8" id="plaName" >
                        </div>
                        <div class="form-group row">
                            <label class="col-form-label col-sm-3">简介:</label>
                            <input type="text" class="form-control col-sm-8" id="plaDes">
                        </div>
                        <div class="form-group row">
                            <label class="col-form-label col-sm-3">旺季门票:</label>
                            <input type="text" class="form-control col-sm-8" id="plaHotticket">
                        </div>
                        <div class="form-group row">
                            <label class="col-form-label col-sm-3">淡季门票:</label>
                            <input type="text" class="form-control col-sm-8" id="plaDimticket">
                        </div>
                        <div class="form-group row">
                            <label class="col-form-label col-sm-3">所属省份:</label>

                            <select style="height: 40px" class="form-control col-sm-8" id="plaProvince" name="status">
                                <option value="" >选择省份</option>

                                <option th:each="pro : ${placeList1}" th:value="${pro.id}" th:text="${pro.name}"></option>
                            </select>

                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary" onclick="save()">提交</button>
                </div>
            </div>
        </div>
    </div>


    <!--景点更新模态窗口-->
    <div class="modal fade" id="updatePla" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLabel1"><span style="color: #1e7e34;font-weight: bold">编辑景点</span> </h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <input type="hidden" class="form-control col-sm-8"  id="plaId1" >
                        <div class="form-group row">
                            <label class="col-form-label col-sm-3">景点:</label>
                            <input type="text" class="form-control col-sm-8" id="plaName1" >
                        </div>
                        <div class="form-group row">
                            <label class="col-form-label col-sm-3">简介:</label>
                            <input type="text" class="form-control col-sm-8" id="plaDes1">
                        </div>
                        <div class="form-group row">
                            <label class="col-form-label col-sm-3">旺季门票:</label>
                            <input type="text" class="form-control col-sm-8" id="plaHotticket1">
                        </div>
                        <div class="form-group row">
                            <label class="col-form-label col-sm-3">淡季门票:</label>
                            <input type="text" class="form-control col-sm-8" id="plaDimticket1">
                        </div>
                        <div class="form-group row">
                            <label class="col-form-label col-sm-3">所属省份:</label>

                            <select style="height: 40px" class="form-control col-sm-8" id="plaProvince1" name="status">
                                <option value="" >选择省份</option>

                                <option th:each="pro : ${placeList1}" th:value="${pro.id}" th:text="${pro.name}"></option>
                            </select>

                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary" onclick="save1()">提交</button>
                </div>
            </div>
        </div>
    </div>



</div>
</body>

</html>